{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "07e55f56",
   "metadata": {},
   "source": [
    "---\n",
    "* 2023-11-1\n",
    "* 课程：python语言\n",
    "* week07（上课周）\n",
    "---"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4e7ee62c",
   "metadata": {},
   "source": [
    "# 本周内容\n",
    "\n",
    "## 1. 列表的概念\n",
    "\n",
    "## 2. 列表的性质\n",
    "\n",
    "## 3. 列表的一般方法\n",
    "\n",
    "\n",
    "# 1. 列表的概念"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "394b58eb",
   "metadata": {},
   "source": [
    "* 思考：如果我们想要存放一个班级的同学名字，目前我们有什么样的方法？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "86362117",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "扎里苏 萧逸 奇斯利 下明星\n"
     ]
    }
   ],
   "source": [
    "# 第一种方法\n",
    "\n",
    "name1 = \"扎里苏\"\n",
    "name2 = \"萧逸\"\n",
    "name3 = \"奇斯利\"\n",
    "name4 = \"下明星\"\n",
    "print(name1,name2,name3,name4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "b6771ca1",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "扎里苏 萧逸 奇斯利 下明星\n"
     ]
    }
   ],
   "source": [
    "# 第二种方式\n",
    "name = \"扎里苏 萧逸 奇斯利 下明星\"\n",
    "print(name)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "bcda2366",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'奇斯利'"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "name[7:10]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "6533b4cf",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['扎里苏', '萧逸', '奇斯利', '下明星']\n",
      "<class 'list'>\n"
     ]
    }
   ],
   "source": [
    "name_list = [\"扎里苏\",\"萧逸\",\"奇斯利\",\"下明星\"]\n",
    "print(name_list)\n",
    "print(type(name_list))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "0cfb9aea",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'奇斯利'"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "name_list[2]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "dad90f47",
   "metadata": {},
   "source": [
    "# 2. 列表的性质"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "520e6e5b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'扎里苏'"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "name_list[0]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f3a7f167",
   "metadata": {},
   "source": [
    "## 2.3.列表的可变性"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "13087e42",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['扎里苏', '萧逸', '奇斯利', '下明星']"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "name_list"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "b97e15e5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['扎里苏', '萧逸', '陆沉', '下明星']"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "name_list[2] = \"陆沉\"\n",
    "name_list"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bb1e277c",
   "metadata": {},
   "source": [
    "## 2.3列表存放不同的数据结构的数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "3f86cdb8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['扎里苏', 29, '萧逸', 23, '奇斯利', 2000, '下明星', 22]"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "name_age_list = [\"扎里苏\",29,\"萧逸\",23, \"奇斯利\",2000,\"下明星\",22]\n",
    "name_age_list"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "66aec0d4",
   "metadata": {},
   "source": [
    "## 2.4列表重复性"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "eb9f0b92",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[12, 13, 14, 12, 33, 44, 33]"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "网新_python = [12,13,14,12,33,44,33]\n",
    "网新_python"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e4ae48ad",
   "metadata": {},
   "source": [
    "# 3. 列表的一般方法\n",
    "\n",
    "> 1. 列表的创建\n",
    ">> 1. 直接用[]创建列表，中间的元素用英文的逗号隔开\n",
    ">> 2. 使用list()创建列表\n",
    ">> 3. 增加\n",
    ">> 4. 删除\n",
    "> 2. 列表的处理\n",
    ">> 1. 取值\n",
    ">> 2. 查询\n",
    ">> 3. 增加\n",
    ">> 4. 删除"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3e7b7129",
   "metadata": {},
   "source": [
    "## 3.1列表的创建"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "02ea7c84",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1, 2, 3]\n"
     ]
    }
   ],
   "source": [
    "my_list1 = list((1, 2, 3))\n",
    "print(my_list1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "804eb0d1",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1, 2, 3]\n"
     ]
    }
   ],
   "source": [
    "my_list2 = [1, 2, 3]\n",
    "print(my_list2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "a97e94f3",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1.0, 'Jessa', 3]\n"
     ]
    }
   ],
   "source": [
    "my_list3 = [1.0, 'Jessa', 3]\n",
    "print(my_list3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "d550edff",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[]\n"
     ]
    }
   ],
   "source": [
    "# 创建空列表\n",
    "my_list4 = list()\n",
    "print(my_list4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "26b6015e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[]\n"
     ]
    }
   ],
   "source": [
    "my_list5 = []\n",
    "print(my_list4)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "cf1baaf3",
   "metadata": {},
   "source": [
    "## 3.2列表的方法"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "63fbc80f",
   "metadata": {},
   "source": [
    "### 1. 列表的取值\n",
    "> 1. index取单个值\n",
    "> 2. 切片截取多个值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "e7c31f99",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['扎里苏', '萧逸', '奇斯利', '下明星']\n"
     ]
    }
   ],
   "source": [
    "name_list = [\"扎里苏\",\"萧逸\",\"奇斯利\",\"下明星\"]\n",
    "print(name_list)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "dfc2e4c7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'奇斯利'"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "name_list[2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "b22f2ae8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['奇斯利', '下明星']"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "name_list[-2:]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ec563db9",
   "metadata": {},
   "source": [
    "### 1. 列表的查询\n",
    "\n",
    "* in 方法作为python的一个特殊方法，不仅可以在列表数据使用，其他数据也可\n",
    "* len()对数据长度（范围）进行查询，不仅可以在列表数据使用，其他数据也可"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "40f31398",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"萧逸\" in name_list"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "5689277f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"陆沉\" in name_list"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "65d4b1f0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "4"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(name_list)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5db6be1f",
   "metadata": {},
   "source": [
    "### 3. 关于列表的新增\n",
    "\n",
    "> 1. append()增加\n",
    "> 2. insert()插入、嵌入\n",
    "> 3. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "a6ba0154",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['扎里苏', '萧逸', '奇斯利', '下明星']\n"
     ]
    }
   ],
   "source": [
    "name_list = [\"扎里苏\",\"萧逸\",\"奇斯利\",\"下明星\"]\n",
    "print(name_list)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "5d53d325",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['扎里苏', '萧逸', '奇斯利', '下明星', '陆沉', '陆沉', '陆沉', '陆沉']"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "name_list.append(\"陆沉\")\n",
    "name_list"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "b33efa1d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on built-in function index:\n",
      "\n",
      "index(value, start=0, stop=9223372036854775807, /) method of builtins.list instance\n",
      "    Return first index of value.\n",
      "    \n",
      "    Raises ValueError if the value is not present.\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(name_list.insert)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "55baba6b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['扎里苏', '萧逸', '查理苏', '奇斯利', '下明星', '陆沉', '陆沉', '陆沉', '陆沉']"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "name_list.insert(2,\"查理苏\")\n",
    "name_list"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7a16b056",
   "metadata": {},
   "source": [
    "* 临时讲一个方法：count()统计某个元素在列表中出现的次数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "0b029208",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[12, 13, 14, 12, 33, 44, 33]"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "网新_python = [12,13,14,12,33,44,33]\n",
    "网新_python"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "9286aaec",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "网新_python.count(12)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5e0d270f",
   "metadata": {},
   "source": [
    "* 综合实践：投筛子1000字，统计每一个筛子出现的次数\n",
    "> 1. 创建一个空列表\n",
    "> 2. 通过append方法将每一次产生的筛子数存进去\n",
    "> 3. 通过count方法查询每一筛子面的次数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "f1b8a652",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1000\n",
      "[3, 3, 1, 3, 4, 3, 4, 4, 4, 5, 4, 4, 5, 4, 1, 2, 3, 6, 6, 3, 3, 6, 4, 3, 3, 3, 1, 4, 2, 2, 3, 5, 4, 6, 6, 2, 3, 1, 6, 3, 3, 3, 6, 5, 4, 2, 3, 4, 2, 2, 5, 3, 2, 5, 4, 6, 1, 2, 2, 5, 4, 5, 3, 5, 3, 5, 5, 5, 4, 3, 4, 3, 5, 1, 2, 3, 4, 5, 1, 3, 3, 3, 1, 2, 1, 1, 4, 1, 3, 2, 5, 2, 5, 5, 1, 2, 2, 5, 2, 4, 5, 2, 5, 5, 1, 3, 1, 5, 2, 3, 1, 6, 3, 6, 5, 2, 4, 5, 4, 2, 6, 5, 1, 1, 1, 6, 6, 1, 3, 4, 4, 2, 3, 4, 3, 4, 4, 1, 3, 1, 6, 5, 4, 5, 3, 1, 3, 5, 1, 2, 4, 2, 6, 2, 5, 6, 2, 6, 2, 4, 2, 5, 3, 3, 4, 3, 6, 3, 4, 4, 6, 1, 1, 2, 2, 3, 2, 3, 3, 2, 1, 1, 4, 1, 3, 6, 6, 4, 1, 6, 1, 4, 1, 6, 5, 2, 6, 4, 1, 6, 1, 3, 6, 6, 1, 2,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, 6, 1, 4, 2, 3, 6, 4, 6, 1, 6, 3, 2, 4, 1, 2, 2, 2, 5, 6, 2, 5, 3, 4, 3, 2, 6, 5, 5, 5, 1, 6, 6, 6, 2, 2, 5, 6, 4, 3, 3, 5, 6, 6, 2, 4, 5, 6, 1, 1, 3, 5, 5, 5, 5, 3, 4, 2, 2, 4, 4, 2, 6, 2, 5, 4, 4, 2, 2, 5, 3, 4, 3, 4, 5, 3, 1, 4, 4, 4, 2, 4, 3, 6, 3, 1, 4, 2, 6, 2, 6, 5, 4, 4, 4, 2, 6, 5, 2, 2, 1, 2, 1, 3, 1, 4, 2, 5, 4, 6, 1, 4]\n"
     ]
    }
   ],
   "source": [
    "import random\n",
    "筛子出现的数值列表 = []\n",
    "for i in range(1000):\n",
    "    筛子出现的数值列表.append(random.randint(1,6))\n",
    "    # print(random.randint(1,6))\n",
    "print(len(筛子出现的数值列表))\n",
    "print(筛子出现的数值列表)    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "id": "853c9543",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on method randint in module random:\n",
      "\n",
      "randint(a, b) method of random.Random instance\n",
      "    Return random integer in range [a, b], including both end points.\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(random.randint)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "id": "f2854105",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on class range in module builtins:\n",
      "\n",
      "class range(object)\n",
      " |  range(stop) -> range object\n",
      " |  range(start, stop[, step]) -> range object\n",
      " |  \n",
      " |  Return an object that produces a sequence of integers from start (inclusive)\n",
      " |  to stop (exclusive) by step.  range(i, j) produces i, i+1, i+2, ..., j-1.\n",
      " |  start defaults to 0, and stop is omitted!  range(4) produces 0, 1, 2, 3.\n",
      " |  These are exactly the valid indices for a list of 4 elements.\n",
      " |  When step is given, it specifies the increment (or decrement).\n",
      " |  \n",
      " |  Methods defined here:\n",
      " |  \n",
      " |  __bool__(self, /)\n",
      " |      True if self else False\n",
      " |  \n",
      " |  __contains__(self, key, /)\n",
      " |      Return key in self.\n",
      " |  \n",
      " |  __eq__(self, value, /)\n",
      " |      Return self==value.\n",
      " |  \n",
      " |  __ge__(self, value, /)\n",
      " |      Return self>=value.\n",
      " |  \n",
      " |  __getattribute__(self, name, /)\n",
      " |      Return getattr(self, name).\n",
      " |  \n",
      " |  __getitem__(self, key, /)\n",
      " |      Return self[key].\n",
      " |  \n",
      " |  __gt__(self, value, /)\n",
      " |      Return self>value.\n",
      " |  \n",
      " |  __hash__(self, /)\n",
      " |      Return hash(self).\n",
      " |  \n",
      " |  __iter__(self, /)\n",
      " |      Implement iter(self).\n",
      " |  \n",
      " |  __le__(self, value, /)\n",
      " |      Return self<=value.\n",
      " |  \n",
      " |  __len__(self, /)\n",
      " |      Return len(self).\n",
      " |  \n",
      " |  __lt__(self, value, /)\n",
      " |      Return self<value.\n",
      " |  \n",
      " |  __ne__(self, value, /)\n",
      " |      Return self!=value.\n",
      " |  \n",
      " |  __reduce__(...)\n",
      " |      Helper for pickle.\n",
      " |  \n",
      " |  __repr__(self, /)\n",
      " |      Return repr(self).\n",
      " |  \n",
      " |  __reversed__(...)\n",
      " |      Return a reverse iterator.\n",
      " |  \n",
      " |  count(...)\n",
      " |      rangeobject.count(value) -> integer -- return number of occurrences of value\n",
      " |  \n",
      " |  index(...)\n",
      " |      rangeobject.index(value) -> integer -- return index of value.\n",
      " |      Raise ValueError if the value is not present.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Static methods defined here:\n",
      " |  \n",
      " |  __new__(*args, **kwargs) from builtins.type\n",
      " |      Create and return a new object.  See help(type) for accurate signature.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data descriptors defined here:\n",
      " |  \n",
      " |  start\n",
      " |  \n",
      " |  step\n",
      " |  \n",
      " |  stop\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(range)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "7465611b",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1 163\n",
      "2 178\n",
      "3 162\n",
      "4 174\n",
      "5 176\n",
      "6 147\n"
     ]
    }
   ],
   "source": [
    "for i in range(1,7):\n",
    "    print(i,筛子出现的数值列表.count(i)) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "58bcc697",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "014a2f36",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
